/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Tuan Nguyen
 */
@Entity
@Table(name = "Companys")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Companys.findAll", query = "SELECT c FROM Companys c"),
    @NamedQuery(name = "Companys.findByCompanyID", query = "SELECT c FROM Companys c WHERE c.companyID = :companyID"),
    @NamedQuery(name = "Companys.findByCompanyName", query = "SELECT c FROM Companys c WHERE c.companyName = :companyName"),
    @NamedQuery(name = "Companys.findByAddress", query = "SELECT c FROM Companys c WHERE c.address = :address"),
    @NamedQuery(name = "Companys.findByPhoneNo", query = "SELECT c FROM Companys c WHERE c.phoneNo = :phoneNo"),
    @NamedQuery(name = "Companys.findByFax", query = "SELECT c FROM Companys c WHERE c.fax = :fax"),
    @NamedQuery(name = "Companys.findByWebsite", query = "SELECT c FROM Companys c WHERE c.website = :website"),
    @NamedQuery(name = "Companys.findByEmail", query = "SELECT c FROM Companys c WHERE c.email = :email"),
    @NamedQuery(name = "Companys.findByLogo", query = "SELECT c FROM Companys c WHERE c.logo = :logo"),
    @NamedQuery(name = "Companys.findByImageURL", query = "SELECT c FROM Companys c WHERE c.imageURL = :imageURL"),
    @NamedQuery(name = "Companys.findByCreateDate", query = "SELECT c FROM Companys c WHERE c.createDate = :createDate")})
public class Companys implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "CompanyID")
    private Integer companyID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "CompanyName")
    private String companyName;
    @Lob
    @Size(max = 1073741823)
    @Column(name = "CompanyDescription")
    private String companyDescription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "Address")
    private String address;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "PhoneNo")
    private String phoneNo;
    // @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="Invalid phone/fax format, should be as xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
    @Size(max = 50)
    @Column(name = "Fax")
    private String fax;
    @Size(max = 100)
    @Column(name = "Website")
    private String website;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "Email")
    private String email;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "Logo")
    private String logo;
    @Size(max = 100)
    @Column(name = "ImageURL")
    private String imageURL;
    @Size(max = 10)
    @Column(name = "CreateDate")
    private String createDate;
    @JoinColumn(name = "CreateUserID", referencedColumnName = "UserID")
    @ManyToOne
    private Member1 createUserID;
    @JoinColumn(name = "CompanyTypeID", referencedColumnName = "CompanyTypeID")
    @ManyToOne(optional = false)
    private CompanyType companyTypeID;

    public Companys() {
    }

    public Companys(Integer companyID) {
        this.companyID = companyID;
    }

    public Companys(Integer companyID, String companyName, String address, String phoneNo, String email, String logo) {
        this.companyID = companyID;
        this.companyName = companyName;
        this.address = address;
        this.phoneNo = phoneNo;
        this.email = email;
        this.logo = logo;
    }

    public Integer getCompanyID() {
        return companyID;
    }

    public void setCompanyID(Integer companyID) {
        this.companyID = companyID;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyDescription() {
        return companyDescription;
    }

    public void setCompanyDescription(String companyDescription) {
        this.companyDescription = companyDescription;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getImageURL() {
        return imageURL;
    }

    public void setImageURL(String imageURL) {
        this.imageURL = imageURL;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public Member1 getCreateUserID() {
        return createUserID;
    }

    public void setCreateUserID(Member1 createUserID) {
        this.createUserID = createUserID;
    }

    public CompanyType getCompanyTypeID() {
        return companyTypeID;
    }

    public void setCompanyTypeID(CompanyType companyTypeID) {
        this.companyTypeID = companyTypeID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (companyID != null ? companyID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Companys)) {
            return false;
        }
        Companys other = (Companys) object;
        if ((this.companyID == null && other.companyID != null) || (this.companyID != null && !this.companyID.equals(other.companyID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "companyID=" + companyID + " ";
    }
    
}
